include(GNUInstallDirs)
include(CheckSymbolExists)
include(CheckLibraryExists)

set(SOURCES
    cmd.c
    log.c
)


set(CCMD_SOVERSION_FULL "0.0.1")
set(CMAKE_BUILD_TYPE DEBUG)

set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
add_library(cmdobj OBJECT ${SOURCES})
set_target_properties(cmdobj PROPERTIES COMPILE_FLAGS " -fPIC")


add_library(ccmd SHARED $<TARGET_OBJECTS:cmdobj>)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})


# installation
install(TARGETS ccmd DESTINATION ${CMAKE_INSTALL_LIBDIR})

# public headers
set(LIB_HEADERS
    cmd.h
    )
install(FILES ${LIB_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ccmd)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libccmd.pc DESTINATION /usr/lib/pkgconfig)

